package cmcc.dbi.execEnum;

public enum DbTypeOfUrlEnum {

//    //用于巡检所有库的通用写法--暂时无用，将个技术栈的util替换为getCmpResJdbcUtil有用---这样比较难检查日志，但是省略代码
    MySQL("MySQL", "jdbc:mysql://DBIP:DBPORT/DBNAME?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true"),
    PanweiDB("PanweiDB", "jdbc:panweidb://DBIP:DBPORT/DBNAME"),
    PostgreSQL("PostgreSQL", "jdbc:postgresql://DBIP:DBPORT/DBNAME"),
    KingBase("KingBase","jdbc:kingbase8://DBIP:DBPORT/DBNAME"),
    AntDB("AntDB", "jdbc:postgresql://DBIP:DBPORT/DBNAME"),
    GoldenDB("GoldenDB", "jdbc:mysql://DBIP:DBPORT/DBNAME"),
    GreatDB("GreatDB", "jdbc:mysql://DBIP:DBPORT/DBNAME"),
    Oracle("Oracle", "jdbc:oracle:thin:@DBIP:DBPORT:DBNAME"),
    OceanBase("OceanBase", "jdbc:oceanbase://DBIP:DBPORT/DBNAME?useSSL=false&useUnicode=true&characterEncoding=utf-8");
//
//    PanweiDB("PanweiDB", "jdbc:panweidb://DBIP:DBPORT/DBNAME"),
//    KingBase("KingBase","jdbc:kingbase8://DBIP:DBPORT/DBNAME"),
//    AntDB("AntDB", "jdbc:postgresql://DBIP:DBPORT/DBNAME");

    private String dbType;
    private String dbUrl;

    public String getDbType() {
        return dbType;
    }

    public String getDbUrl() {
        return dbUrl;
    }


    DbTypeOfUrlEnum(String dbType, String dbUrl) {
        this.dbType = dbType;
        this.dbUrl = dbUrl;
    }

    public static DbTypeOfUrlEnum match(String type) {

        DbTypeOfUrlEnum result = null;

        for (DbTypeOfUrlEnum dbTypeOfUrlEnum : DbTypeOfUrlEnum.values()) {
            if (dbTypeOfUrlEnum.getDbType().equals(type)) {
                result = dbTypeOfUrlEnum;
                break;
            }
        }

        return result;
    }


}
